import { reactive } from "vue";
import type { FormRules } from "element-plus";

/** 自定义表单规则校验 */
export const formRules = reactive(<FormRules>{
  categoryName: [
    { required: true, message: "分类名称为必填项", trigger: "blur" },
    { min: 2, max: 20, message: "分类名称长度在 2 到 20 个字符", trigger: "blur" }
  ],
  sortValue: [
    { required: true, message: "排序值为必填项", trigger: "blur" },
    { type: "number", min: 0, max: 999, message: "排序值必须在 0 到 999 之间", trigger: "blur" }
  ]
});
